package com.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sfzy.mapper.CourseCollectMapper;
import com.sfzy.service.CourseCollectService;
import com.sfzy.entity.CourseCollect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseCollectServiceImpl implements CourseCollectService {
    @Autowired
    private CourseCollectMapper courseCollectMapper;

    @Override
    public int addCourseCollect(CourseCollect courseCollect) {
        return courseCollectMapper.addCourseCollect(courseCollect);
    }

    @Override
    public int deleteCourseCollect(int id) {
        return courseCollectMapper.deleteCourseCollect(id);
    }

    @Override
    public int updateCourseCollect(CourseCollect courseCollect) {
        return courseCollectMapper.updateCourseCollect(courseCollect);
    }

    @Override
    public CourseCollect getCourseCollectById(int id) {
        return courseCollectMapper.getCourseCollectById(id);
    }

    @Override
    public List<CourseCollect> getAllCourseCollect() {
        return courseCollectMapper.getAllCourseCollect();
    }

    @Override
    public PageInfo<CourseCollect> getAllCourseCollectByPage(CourseCollect courseCollect,int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<CourseCollect> list = courseCollectMapper.getAllCourseCollect();
        PageInfo<CourseCollect> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
